﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace Coway.Ordering.Sellers
{
    /// <summary>
    /// 销售者的应用服务
    /// </summary>
    public class SellerAppService : CrudAppService<
            Seller, //The Book entity
            SellerDto, //Used to show books
            string, //Primary key of the book entity
            PagedAndSortedResultRequestDto, //Used for paging/sorting
            CreateUpdateSellerDto>, //Used to create/update a book
        ISellerAppService //implement the IBookAppService
    {
        public SellerAppService(
           IRepository<Seller, string> repository)
           : base(repository)
        {
        }

        protected override async Task<Seller> MapToEntityAsync(CreateUpdateSellerDto createInput)
        {
            var entity = await base.MapToEntityAsync(createInput);
            entity.SetId(createInput.Id ?? Guid.NewGuid().ToString());
            return entity;
        }
    }
}
